﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Pages/Default.master" AutoEventWireup="true"
    CodeBehind="ShareList.aspx.cs" Inherits="AUV5.Web.Pages.ShareList" %>

<%@ Register Src="UCWorkShare.ascx" TagName="UCWorkShare" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        $(function () {
            var pageindex = 2;
            var pagesize = 4;
            var recordcount = $('[id$=hfRecordCount]').val();
            $('#showMore').click(function () {
                if (Math.ceil(recordcount / pagesize) >= pageindex) {
                    loadShare(pageindex, pagesize);

                    pageindex++;
                }
            });
            $('[id$=hlShareImage]').click(function (e) {
                openColorBox(this.href);
                preventDefault(e);
            });
        });

        function openColorBox(href) {
            if (href.indexOf('/Pages/VideoPlay.aspx') != -1) {
                $.colorbox(
                   {
                       iframe: true,
                       innerWidth: 500,
                       innerHeight: 400,
                       href: href
                   });
            }
            else {
                $.colorbox({
                    href: href
                });
            }
        }


        function loadShare(pageindex, pagesize) {
            $.ajax({
                url: '/Handler/ShareHandler.ashx',
                type: 'post',
                data: { pageindex: pageindex, pagesize: pagesize },
                success: function (response) {
                    var res = eval(response);
                    var containers = $('.shareinfolist').find('ul');

                    for (var i = 0; i < res.length; i++) {
                        $(containers[i]).append($("<div>").html(res[i]).fadeIn(2000));
                    }
                }
            });
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:HiddenField ID="hfRecordCount" runat="server" />
    <p class="title_most">
        <img src="/!images/title_most.png" /></p>
    <div class="shareinfolist">
        <asp:Repeater ID="repShare" runat="server">
            <ItemTemplate>
                <ul <%#(Container.ItemIndex==3)?" class='notmar'":"" %>>
                    <div>
                        <uc1:UCWorkShare ID="UCWorkShare1" runat="server" DataSource="<%#(Container.DataItem as AUV5.Model.WorksShare)%>"
                            IsCover="false" />
                    </div>
                </ul>
            </ItemTemplate>
        </asp:Repeater>
        <p class="clear">
        </p>
    </div>
    <div>
        <a id="showMore" href="javascript:void(0)">更多...</a>
    </div>
</asp:Content>
